#ifndef TACHO_H
#define TACHO_H

#include <avr/io.h>

#define TACHO_PORT EICRA
#define TACHO_PIN INT0
#define TACHO_MSK EIMSK
#define TACHO_INT_VECT INT0_vect

#define TACHO_NB_SLOTS 6
#define ALPHA_NUM 1
#define ALPHA_DEN 2

extern volatile uint8_t HR_COUNTER0;        // High Register for Timer/Counter0
extern volatile uint16_t tacho_period;      // Measured period
extern volatile uint32_t tacho_averaged;       // Averaged period
extern volatile uint16_t  tacho_nb_pulse;   // Number of measured pulses
extern volatile uint8_t tacho_got_pulse;    // Flag for acquired pulse

extern void set_pin_int(void);
extern void clear_pin_int(void);
extern void tacho_init ( void );
extern int tacho_get_rpm ( void );

#endif /* TACHO_H */
